package com.yugao.fintech.antelope.pay.common.model.mq;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;

/**
 * 定义MQ消息格式
 * 业务场景： [ 支付订单超时关闭 ]
 *

 */
@Getter
@Setter
public class ErrorMQ {
    /**
     * 重试超过一定次数后, 消息转发到的目标队列和交换机
     */
    public static final String QUEUE = "pay_service.error.queue";
    public static final String KEY = "pay_service.error.key";
    public static final String EXCHANGE = "pay_service.error.exchange";

    public ErrorMQ() {

    }

    /**
     * 定义Msg消息载体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    @AllArgsConstructor
    public static class MsgPayload extends JSONObject {
        private String msgId;
    }

    /**
     * 解析MQ消息， 一般用于接收MQ消息时
     */
    public static MsgPayload parse(String msg) {
        return JSON.parseObject(msg, MsgPayload.class);
    }
}
